import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import Vant from 'vant'
import 'vant/lib/index.css'
import { createPinia } from 'pinia'
import piniaPersist from 'pinia-plugin-persistedstate'
// import Particles from 'particles.vue3'


// ECharts 相关导入
import ECharts from 'vue-echarts'
import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers'
import { PieChart, BarChart, LineChart } from 'echarts/charts'
import {
    TitleComponent,
    TooltipComponent,
    LegendComponent,
    GridComponent,
    DatasetComponent
} from 'echarts/components'

// 按需注册 ECharts 模块
use([
    CanvasRenderer,
    PieChart,
    BarChart,
    LineChart,
    TitleComponent,
    TooltipComponent,
    LegendComponent,
    GridComponent,
    DatasetComponent
])

// 初始化 Pinia
const pinia = createPinia()
pinia.use(piniaPersist)

// 创建应用实例
const app = createApp(App)

// 全局注册 Vant
app.use(Vant)

// app.use(Particles)

// 注册状态管理
app.use(pinia)

// 注册路由
app.use(router)


// 全局注册 ECharts 组件（使用 kebab-case 命名）
app.component('v-chart', ECharts)

// 挂载应用
app.mount('#app')
